package com.gxa.service.points.impl;


import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.gxa.dto.pointsdto.IntegralDto;
import com.gxa.entity.points.ExchangeRecord;
import com.gxa.entity.points.IntegralType;
import com.gxa.mapper.points.IntegralTypeMapper;
import com.gxa.service.points.IntegralTypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Set;

/**
 * <p>
 * 积分类型 服务实现类
 * </p>
 *
 * @author yjl
 * @since 2022-10-17 10:36:06
 */
@Service
public class IntegralTypeServiceImpl extends ServiceImpl<IntegralTypeMapper, IntegralType> implements IntegralTypeService {
    @Autowired
    private IntegralTypeMapper integralTypeMapper;

    @Override
    public IntegralType quertById(Integer id) {
        IntegralType integralType =this.integralTypeMapper.selectById(id);
        return integralType;

    }

    @Override
    public PageInfo<IntegralType> queryAll(Integer pagenum,Integer count) {
        Page<IntegralType> page1 = PageHelper.startPage(pagenum,count);
        List<IntegralType> integralTypeList = this.integralTypeMapper.selectList(null);
        PageInfo<IntegralType> pageInfo = new PageInfo<IntegralType>(integralTypeList);

        return pageInfo;
    }

    @Override
    public PageInfo queryByName(String name,Integer pagenum,Integer count) {
        Page<IntegralType> page1 = PageHelper.startPage(pagenum,count);
        List<IntegralType> integralTypeList = this.integralTypeMapper.queryByName(name);
        PageInfo<IntegralType> pageInfo = new PageInfo<IntegralType>(integralTypeList);
        return pageInfo;
    }

    @Override
    public void delete(Integer id) {
        this.integralTypeMapper.deleteById(id);

    }

    @Override
    public void update(IntegralType integralType) {
        this.integralTypeMapper.updateById(integralType);

    }

    @Override
    public void add(IntegralType integralType) {
        this.integralTypeMapper.insert(integralType);
    }

    @Override
    public Set<IntegralType> queryList() {
        Set<IntegralType> integralTypeSet = this.integralTypeMapper.queryList();
        return integralTypeSet;
    }
}
